package man;

public class Student extends Person {
    private String no;
    private double scoreEn;
    private double scoreMath;
    private double scoreCh;

    public Student(String name, String sex, int age, String no, double scoreEn, double scoreMath, double scoreCh) {
        super(name, sex, age);
        this.no = no;
        this.scoreEn = scoreEn;
        this.scoreMath = scoreMath;
        this.scoreCh = scoreCh;
    }

    public double aver() {
        return (scoreEn + scoreMath + scoreCh) / 3;
    }

    public double max() {
        return Math.max(scoreEn, Math.max(scoreMath, scoreCh));
    }

    public double min() {
        return Math.min(scoreEn, Math.min(scoreMath, scoreCh));
    }

    @Override
    public String toString() {
        return super.toString() + ", 学号：" + no + ", 平均分：" + aver() + ", 最高分：" + max() + ", 最低分：" + min();
    }
}